var time = 0;
var NodeSet = require("./NodeSet");
var Plot = require("../Plot");
var CanvasDom = document.querySelector("#myCanvas");
// @ts-ignore
var plot = new Plot.Plot(CanvasDom)

var connectArr = [
  [4, 5, 7],
  [2, 4, 5],
  [1, 3, 6],
  [2, 4, 7],
  [0, 1, 3],
  [0, 1, 6],
  [2, 5, 7],
  [0, 3, 6]
];
// var { len, speed, w1e } = initStat();
// var len = 8;
var w1e = new NodeSet(connectArr.length);
function draw(w1e, connectArr) {
  plot.drawNodeSet(w1e.nodeArr);
  for (var i = 0; i < connectArr.length; i++) {
    for (var j = 0; j < connectArr[i].length; j++) {
      plot.line(w1e.nodeArr[i], w1e.nodeArr[connectArr[i][j]]);
    }
  }
}



function test() {
  var w1e = new NodeSet(1000);
  w1e.initByFunc(function (x) {
    return Math.atanh(x);
  });
  setInterval(function () {
    plot.drawNodeSet(w1e.nodeArr);
  }, 50);
}


window.plot = plot;
draw(w1e, connectArr);
//  plot.drawNodeSet(w1e.NodeArr);


var canvasMv = require("./canvasMv")

canvasMv(CanvasDom, w1e.nodeArr, function () {
  plot.clean();
  draw(w1e, connectArr);
});